<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>文字跳跃</title>
</head>
<body>
	<p id="pid" font-size='18px' ></p>
</body>
	<script>
		pid = document.getElementById("pid");
		str = "JavaScript";

		function demo(i,str){
			tmp = str.substring(0,i);
			tmp += "<font color='red' size='24px' >"+str[i]+"</font>";
			tmp += str.substr(i+1);
			return tmp;
		}
		i=0;
		setInterval(function(){
			if(i>=str.length){
				i=0;
			}
			pid.innerHTML = demo(i,str);
			i++;
		},100);
		
	</script>
</html>